<!DOCTYPE html>
<html>
  
  <head>
    <title>语音和合成博客朗读器</title>
    <script type="text/javascript">
      const {clipboard,remote,ipcRenderer} = require('electron');
      const DataStore = require('./app-store')
      const dataStore = new DataStore()
      /*
      //2022-08-08  百度文字转语音api已失效
      //搜狗api
      let sogouApi = "https://fanyi.sogou.com/reventondc/synthesis?text=" + content + "&speed=1&lang=zh-CHS&from=translateweb&speaker=6";
      //有道api
      let youdaoApi = "https://tts.youdao.com/fanyivoice?word=" + content + "&le=zh&keyfrom=speaker-target";
      */

      //获取速度配置
      let spd = dataStore.getSpd();
      let ttsApi = dataStore.getTTSApi();
      //读取剪切板内容
      let content = encodeURI(clipboard.readText());
      ttsApi = ttsApi.replace("__TEXT__", content).replace("__SPD__", spd);

      var mp3 = new Audio(ttsApi);// h5自带Audio控件 播放音频
      mp3.play();//播放音频

  	</script>
  </head>
  
  <body></body>

</html>